public static Object performRuleOnData(final String className, final String returnMethodName, final Object returnIfNull, final Object... arguments) ...
The Drools component integration is an example of integrating business rules with your data. This example demonstrates how a business rule can be triggered via a User Defined Function (UDF).
All the code discussed in this tutorial is available in the drools-integration quickstart.
See the README.md for directions to run the quick start.
The UDF (RulesUDF.java) is written to load one or more drools .drl file(s) that is defined as a property. An example is:
<property name="org.teiid.drools.UDF" value="org.jboss.teiid.quickstart.data.MarketData:MyBusinessRules.drl"/>
where: - value format is: POJO className:.drl file[,POJO className:.drl,…]
The format maps the POJO to the rule that will process it.
The caller to the UDF will call the following function method:
public static Object performRuleOnData(final String className, final String returnMethodName, final Object returnIfNull, final Object... arguments) ...
where:
className: class name of the POJO to be instantiated and passed to the rules
returnMethodName: name of the method to call on the POJO to get the return value (if one)
returnIfNull: if returnMethodName returns a null value, then default to returnIfNull value
arguments: is a variable number of objects, that must match to the constructor of the POJO.
So all the arguments will be passed in when the "className" is instantiated.
Other integration scenarios, such as using Teiid as a data integration engine under Drools or interacting with live knowledge base, are of course also possible.